package com.endoc.designpattern.visit;

import com.endoc.designpattern.entity.Fruit;
import com.endoc.designpattern.entity.fruit.Apple;
import com.endoc.designpattern.entity.fruit.Banana;
import com.endoc.designpattern.entity.fruit.Orange;

/**
 * 访问者模式
 */
public class Visit {

    public void sell(Orange orange){
        System.out.println(orange.name());
    }

    public void sell(Apple apple){
        System.out.println(apple.name());
    }

    public void sell(Banana banana){
        System.out.println(banana.name());
    }

    public void sell(Fruit fruit){
        System.out.println("其他水果方法被调用了"+fruit.name());
    }
}
